#***************************************************************************
#*   Copyright (c) 2020 Carlo Pavan                                        *
#*                                                                         *
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU Lesser General Public License (LGPL)    *
#*   as published by the Free Software Foundation; either version 2 of     *
#*   the License, or (at your option) any later version.                   *
#*   for detail see the LICENCE text file.                                 *
#*                                                                         *
#*   This program is distributed in the hope that it will be useful,       *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU Library General Public License for more details.                  *
#*                                                                         *
#*   You should have received a copy of the GNU Library General Public     *
#*   License along with this program; if not, write to the Free Software   *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA                                                                   *
#*                                                                         *
#***************************************************************************
"""Provide the object code for Arch Wall object."""
## @package wall
# \ingroup ARCH
# \brief Provide the object code for Arch Wall.

import FreeCAD as App
import DraftVecUtils
from archobjects.archview import ArchView 

if App.GuiUp:
    import FreeCADGui as Gui
    from archviewproviders.view_archview import ViewProviderArchView


def make_arch_view(objectslist=None, name="View"):
    """TODO Properly document when finished
    """

    if not App.ActiveDocument:
        App.Console.PrintError("No active document. Aborting\n")
        return

    # Add a Wall object to the docume
    # TODO: verify if it's necessary to split this in 2 to have the 'if App.GuiUp:' 
    # guard for the viewprovider
    obj = App.ActiveDocument.addObject('Part::FeaturePython', 'ArchView', ArchView(), ViewProviderArchView(), True)   

    App.ActiveDocument.recompute()

    return obj


